package com.pig.openg1;

import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ConfigurationInfo;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

import com.pig.openg1.graphics.DrawView5;
import com.pig.openg1.render.GraphFiveRender;
import com.pig.openg1.render.GraphFourRender;
import com.pig.openg1.render.GraphOneRender;
import com.pig.openg1.render.GraphThreeRender;
import com.pig.openg1.render.GraphTwoRender;

public class ShowAppActivity extends AppCompatActivity {

    private final String TAG = ShowAppActivity.class.getSimpleName();

    private DrawView5 mSurfaceView;
    private GLSurfaceView mSimpleView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show);
        mSurfaceView = findViewById(R.id.view5);
        mSimpleView = findViewById(R.id.view4);
        ActivityManager mManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        ConfigurationInfo mConfigurate = mManager.getDeviceConfigurationInfo();
        boolean isSupport = mConfigurate.reqGlEsVersion >= 0x2000;
        Log.e(TAG,"version : "+ mConfigurate.reqGlEsVersion);
        if(isSupport)
        {
            mSurfaceView.setEGLContextClientVersion(2);
            mSurfaceView.setRenderer(new GraphFiveRender(ShowAppActivity.this));

            mSimpleView.setEGLContextClientVersion(2);
            mSimpleView.setRenderer(new GraphTwoRender());
            Log.i(TAG,"加载当前的");
        }
        else
        {
            Log.i(TAG,"当前的版本较低！");
            return ;
        }
    }


    @Override
    protected void onPause() {
        super.onPause();
        mSurfaceView.onPause();
        mSimpleView.onPause();
    }

    @Override
    protected void onResume() {
        super.onResume();
        mSurfaceView.onResume();
        mSimpleView.onResume();
    }
}
